/*
 * @lc app=leetcode.cn id=1732 lang=javascript
 *
 * [1732] 找到最高海拔
 */

// @lc code=start
/**
 * @param {number[]} gain
 * @return {number}
 */
var largestAltitude = function (gain) {
  let height = 0;
  let max = 0;
  gain.forEach(item => {
    height += item;
    max = Math.max(max, height);
  })
  return max;
};
// @lc code=end

